var axios = require('axios');
axios.defaults.headers['Content-Type'] = 'application/json;charset=utf-8';
axios.defaults.timeout = 90000;
axios.defaults.withCredentials = true;
axios.defaults.crossDomain = true;

axios.interceptors.request.use(
  config => {
    config.params = Object.assign(config.params || {}, { md: Math.random() });
    return config;
  },
  error => {
    return Promise.reject(error);
  }
);

axios.interceptors.response.use(
  response => {
    return response.data;
  },
  error => {
    return Promise.reject(error); // reject这个错误信息
  }
);

module.exports =  axios;
